package com.ruoyi.system.api.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.utils.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;

public class WxUser implements Serializable {
    @ApiModelProperty(value = "用户序号")
    private Long userId;
    @ApiModelProperty(value = "登录名 这个真不能少，创建token用")
    private String userName;
    @ApiModelProperty(value = "昵称")
    private String nickName;
    @ApiModelProperty(value = "电话")
    private String phone;
    @ApiModelProperty(value = "头像链接")
    private String avatarUrl;
    @ApiModelProperty(value = "openid")
    private String openid;

    @ApiModelProperty(value = "驾驶证号")
    private String licenseNo;

    @ApiModelProperty(value = "性别")
    private String gender;


    @ApiModelProperty(value = "司机联系方式")
    private String phoneNo;

    @ApiModelProperty(value = "初次领证日期", example = "2020-01-01", dataType = "string")
    private String firstApprovedDate;

    @ApiModelProperty(value = "驾驶证发证机关")
    private String agency;

    @ApiModelProperty(value = "所属公司编码")
    private String orgCode;
    @ApiModelProperty(value = "司机名字")
    private String name;

    @ApiModelProperty(value = "身份 司机还是 业务员")
    private String identity;

    @ApiModelProperty(value = "数据来源填 来源于哪个平台")
    private String dataSource;
    @ApiModelProperty(value = "身份证真名")
    private boolean realName;
    @ExcelProperty("准驾车型")
    @ApiModelProperty(value = "准驾车型")
    private String approvedType;

    @ExcelProperty("驾驶证有效起始日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "驾驶证有效起始日期", example = "2020-01-01", dataType = "string")
    private String startDate;
    @ExcelProperty("驾驶证有效截止日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "驾驶证有效截止日期", example = "2020-01-01", dataType = "string")
    private String endDate;
    @ApiModelProperty(value = "驾驶证正面")
    private String driverLicenseImg;

    @ApiModelProperty(value = "驾驶证副业")
    private String driverLicenseBackImg;

    @ApiModelProperty(value = "身份证号码")
    private String idCard;
    @ApiModelProperty(value = "司机审核状态")
    private String dataSatus;

    /**
     * 身份证的签发日期
     */
    @ApiModelProperty(value = "身份证的签发日期" )
    private String issueDate;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "身份证的有效期截止日期" )
    private String expiryDate;

    public WxUser() {
    }



    @ApiModelProperty(value = "身份证正面照片")
    private String idCardImg;

    /**
     * 身份证背面照片
     */
    @ApiModelProperty(value = "身份证背面照片")
    private String idCardBackImg;


    public void setIdentity(String identity) {
        this.identity = identity;
    }

    public boolean isRealName() {

        if(StringUtils.isNotEmpty(  getIdCard() )  ){
            return true;
        }

        return realName;
    }

    public void setRealName(boolean realName) {

        this.realName = realName;
    }


    public String dataSatus() {
        if(StringUtils.isEmpty( dataSatus)){
            return "司机信息未填报";
        }
        return dataSatus;
    }

    public void setDataSatus(String dataSatus) {
        this.dataSatus = dataSatus;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getLicenseNo() {
        return licenseNo;
    }

    public void setLicenseNo(String licenseNo) {
        this.licenseNo = licenseNo;
    }

    public String getGender() {
        if (idCard == null || idCard.length() != 18) {
            // 处理无效身份证：返回null或默认值，也可抛异常
            return null; // 或 return "0"; 根据需求调整
        }
        char genderCode = idCard.charAt(16); // 获取第17位字符
        if (genderCode < '0' || genderCode > '9') {
            return null; // 非数字字符处理
        }
        // 判断奇偶：奇数为男(1)，偶数为女(0)
        return (genderCode % 2 != 0) ? "1" : "0";
    }

    public void setGender(String gender) {
        this.gender = gender;
    }




    public String getFirstApprovedDate() {
        return firstApprovedDate;
    }

    public void setFirstApprovedDate(String firstApprovedDate) {
        this.firstApprovedDate = firstApprovedDate;
    }

    public String getAgency() {
        return agency;
    }

    public void setAgency(String agency) {
        this.agency = agency;
    }

    public String getOrgCode() {
        return orgCode;
    }

    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIdentity() {
        return identity;
    }



    public void setApprovedType(String approvedType) {
        this.approvedType = approvedType;
    }

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getDriverLicenseImg() {
        return driverLicenseImg;
    }






    public String getDataSatus() {
        return dataSatus;
    }


    public String getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(String expiryDate) {
        this.expiryDate = expiryDate;
    }

    public String getIdCardImg() {
        return idCardImg;
    }

    public void setIdCardImg(String idCardImg) {
        this.idCardImg = idCardImg;
    }

    public String getIdCardBackImg() {
        return idCardBackImg;
    }

    public void setIdCardBackImg(String idCardBackImg) {
        this.idCardBackImg = idCardBackImg;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getPhoneNo() {
        return phoneNo;
    }

    public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }

    public String getApprovedType() {
        return approvedType;
    }

    public void setDriverLicenseImg(String driverLicenseImg) {
        this.driverLicenseImg = driverLicenseImg;
    }

    public String getDriverLicenseBackImg() {
        return driverLicenseBackImg;
    }

    public void setDriverLicenseBackImg(String driverLicenseBackImg) {
        this.driverLicenseBackImg = driverLicenseBackImg;
    }

    public String getIssueDate() {
        return issueDate;
    }

    public void setIssueDate(String issueDate) {
        this.issueDate = issueDate;
    }

    public String getDataSource() {
        return dataSource;
    }

    public void setDataSource(String dataSource) {
        this.dataSource = dataSource;
    }

    @Override
    public String toString() {
        return "WxUser{" +
                "userId=" + userId +
                ", userName='" + userName + '\'' +
                ", nickName='" + nickName + '\'' +
                ", phone='" + phone + '\'' +
                ", avatarUrl='" + avatarUrl + '\'' +
                ", openid='" + openid + '\'' +
                ", licenseNo='" + licenseNo + '\'' +
                ", gender='" + gender + '\'' +
                ", phoneNo='" + phoneNo + '\'' +
                ", firstApprovedDate='" + firstApprovedDate + '\'' +
                ", agency='" + agency + '\'' +
                ", orgCode='" + orgCode + '\'' +
                ", name='" + name + '\'' +
                ", identity='" + identity + '\'' +
                ", dataSource='" + dataSource + '\'' +
                ", realName=" + realName +
                ", approvedType='" + approvedType + '\'' +
                ", startDate='" + startDate + '\'' +
                ", endDate='" + endDate + '\'' +
                ", driverLicenseImg='" + driverLicenseImg + '\'' +
                ", driverLicenseBackImg='" + driverLicenseBackImg + '\'' +
                ", idCard='" + idCard + '\'' +
                ", dataSatus='" + dataSatus + '\'' +
                ", issueDate='" + issueDate + '\'' +
                ", expiryDate='" + expiryDate + '\'' +
                ", idCardImg='" + idCardImg + '\'' +
                ", idCardBackImg='" + idCardBackImg + '\'' +
                '}';
    }
}
